|
|
|
|
|
|
|
You can also use Visual Basic syntax to combine several data table columns into a single column in the result set. Enter and execute the following example and compare your results to Figure 8.18. |
|
|
|
|
|
|
|
|
SELECT Name, City+", "+StateProv+" "+Zip AS ADDRESS
FROM Publishers |
|
|
|
|
|
|
|
|
Figure 8.18.
Using Visual Basic syntax to combine columns. |
|
|
|
|
|
|
|
|
You can also use Visual Basic functions as part of the WHERE clause in an SQL statement. The following example (Figure 8.19) returns only rows that have the letter a as the second character in the Name column. |
|
|
|
|
|
|
|
|
SELECT Name FROM Publishers
WHERE Mid$(Name,2,1)="a" |
|
|
|
|
|
|
|
|
Figure 8.19.
Using Visual Basic functions
in an SQL WHERE clause. |
|
|
|
|
|
|
|
|
Even though using familiar Visual Basic functions and syntax is very handy, it has its drawbacks. Chief among them is the fact that after you create an SQL statement that uses |
|
|
|
|
|